package com.ccys.cms.controller.userManagement;

import com.ccys.cms.service.userManagement.DoctorSpecialistService;
import com.ccys.common.vo.ResponseResult;
import com.ccys.db.dto.userManagement.DoctorSpecialistDto;
import com.ccys.db.vo.masterData.DoctorSpecialistPageQueryVo;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;

/**
 * @program: WhiteCoat
 * @description: 外部专科医生接口
 * @author: ZhangJingCan
 * @create: 2023-12-20 11:18
 **/

@RestController
@RequestMapping("userManagement")
@Api(tags = "userManagement-外部专科医生接口")
public class DoctorSpecialistController {

    @Autowired
    private DoctorSpecialistService doctorSpecialistService;


    @PostMapping("doctorSpecialist")
    @ApiOperation("保存外部专科医生")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "对象id/修改必传", required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "specialisationId", value = "专科ID", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "name", value = "name", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "mobile", value = "电话号码", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "clinicName", value = "诊所名称", required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "address", value = "地址", required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "companyId", value = "Panel,从面板管理接口获取", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "medicalLetter", value = "介绍信内容", required = false, dataType = "string", paramType = "query"),
    })
    public ResponseResult saveDoctorSpecialist(@ApiIgnore DoctorSpecialistDto dto) {
        return doctorSpecialistService.saveDoctorSpecialist(dto);
    }

    @PutMapping("doctorSpecialist")
    @ApiOperation("修改外部专科医生")
    @ApiImplicitParams({
        @ApiImplicitParam(name = "id", value = "对象id/修改必传", required = false, dataType = "string", paramType = "query"),
        @ApiImplicitParam(name = "specialisationId", value = "专科ID", required = true, dataType = "string", paramType = "query"),
        @ApiImplicitParam(name = "name", value = "name", required = true, dataType = "string", paramType = "query"),
        @ApiImplicitParam(name = "mobile", value = "电话号码", required = true, dataType = "string", paramType = "query"),
        @ApiImplicitParam(name = "clinicName", value = "诊所名称", required = false, dataType = "string", paramType = "query"),
        @ApiImplicitParam(name = "address", value = "地址", required = false, dataType = "string", paramType = "query"),
        @ApiImplicitParam(name = "companyId", value = "Panel,从面板管理接口获取", required = true, dataType = "string", paramType = "query"),
        @ApiImplicitParam(name = "medicalLetter", value = "介绍信内容", required = false, dataType = "string", paramType = "query"),
    })
    public ResponseResult editDoctorSpecialist(@ApiIgnore DoctorSpecialistDto dto) {
        return doctorSpecialistService.saveDoctorSpecialist(dto);
    }

    @DeleteMapping("doctorSpecialist")
    @ApiOperation("根据ID删除外部专科医生")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "对象id", required = true, dataType = "string", paramType = "query"),
    })
    public ResponseResult deleteDoctorSpecialist(@ApiIgnore DoctorSpecialistDto dto) {
        return doctorSpecialistService.deleteDoctorSpecialist(dto);
    }


    @GetMapping("doctorSpecialist")
    @ApiOperation("分页查询外部专科医生")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "name", value = "name模糊查询", required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "mobile", value = "电话号码模糊查询", required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "clinicName", value = "诊所名称模糊查询", required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "specialisationId", value = "专科ID/查询所有传null", required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "status", value = "0/1,查询所有传null", required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "startDate", value = "开始日期,格式:yyyy-MM-dd", required = false, dataType = "date", paramType = "query"),
            @ApiImplicitParam(name = "endDate", value = "结束日期,格式:yyyy-MM-dd", required = false, dataType = "date", paramType = "query"),
            @ApiImplicitParam(name = "orderByStr",
                    value = "(默认传：t1.created_on descend),(左到右依次:t1.name,t3.name,t1.mobile,t1.clinic_name,t4.name,t1.status,t2.user_fullname,t1.created_on)",
                    required = true, dataType = "string", paramType = "query"),
    })
    public ResponseResult<PageInfo<DoctorSpecialistPageQueryVo>, Object> findPageDoctorSpecialist(@ApiIgnore DoctorSpecialistDto dto) {
        return doctorSpecialistService.findPageDoctorSpecialist(dto);
    }


    @PutMapping("doctorSpecialist/status")
    @ApiOperation("根据ID修改外部专科医生状态")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "对象id", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "status", value = "状态：0-禁用，1-启用", required = true, dataType = "string", paramType = "query"),
    })
    public ResponseResult updateDoctorSpecialistStatus(@ApiIgnore DoctorSpecialistDto dto) {
        return doctorSpecialistService.updateDoctorSpecialistStatus(dto);
    }

}
